﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

using LowLevelGraphics;
using LowLevelGraphics.Forms;
using LowLevelGraphics.Filter;

namespace ImageRecognition2.Action
{
    /// <summary>
    /// 
    /// </summary>
    public class ActionRGBCMYExtract : AbstractCommand
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ActionRGBCMYExtract"/> class.
        /// </summary>
        public ActionRGBCMYExtract()
        {
        }

        /// <summary>
        /// Runs the specified sender.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public override void Run(object sender, EventArgs e)
        {
            FormGammaInput formGammaInput = new FormGammaInput();
            formGammaInput.red = formGammaInput.green = formGammaInput.blue = 1;

            if (formGammaInput.ShowDialog() == DialogResult.OK)
            {
                Bitmap bitmap = (Bitmap)MainFormSingleton.ActivePictureBox.BackgroundImage;
                UnsafeBitmap unsafeBitmap = new RGBChannelExtract(formGammaInput.red>0, formGammaInput.green>0, formGammaInput.blue>0).Execute(bitmap);
                unsafeBitmap.Dispose();
            }
        }
    }
}
